#include "core.h"
#include "aic.h"
#include "memory.h"
#include "serial.h"
#include "timer.h"
#include "kmem.h"
#include "mem_test.h"
#include "process.h"
#include "tasks.h"
#include "mmu.h"


void start()
{
  write("remap memory...\n\r");
  remap_memory();
  
  write("set interrupt request vector...\n\r");
  init_vector_table();

  write("set mode specific stack pointers...\n\r");
  init_stacks();
  
  write("set kernel memory...\n\r");
  kmem_init();
  
  //write("do memory test...\n\r");
  //mem_test();

  write("initialise mmu...\n\r");
  init_mmu();
  
  write("initialise advanced interrupt controller...\n\r");
  init_aic();
  
  write("initialise system timer...\n\r");
  init_timer();
  
  write("initialise process ...\n\r");
  process_init();
  load_ramdisk(0, "A");
  load_ramdisk(1, "B");

  //load_process( process_pingpong, "A");
  //load_process( process_pingpong, "Z");
  write("enable interrupts in cpu...\n\r");
  enable_irq_in_core();  
  
  int i;
  while (1) {
    write("A");
    for(i = 0; i < 100000; i++);
  }
}

